package ihuotui.test.threadpool;


import org.apache.commons.lang3.RandomUtils;

public class SynPrint implements Runnable {
    private Object syn;
    private int no;
    private int mac;

    public SynPrint(Object syn, int no, int mac) {
        this.syn = syn;
        this.no = no;
        this.mac = mac;
    }

    @SuppressWarnings("static-access")
    public void run() {
        synchronized (syn) {
            try {
                Thread.currentThread().sleep(RandomUtils.nextInt(1, 5) * 100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("mac:" + mac + " no:" + no);
        }
    }
}
